package com.zqh.app.manager.impl;

import com.zqh.app.dao.GroupMapper;
import com.zqh.app.entity.Group;
import com.zqh.app.entity.User;
import com.zqh.app.manager.AppGroupManager;
import com.zqh.common.entity.Page;
import com.zqh.common.entity.Query;
import com.zqh.common.entity.R;
import com.zqh.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("appGroupManager")
public class AppGroupManagerImpl implements AppGroupManager {

    @Autowired
    GroupMapper groupMapper;

    @Override
    public R saveGroup(Query form) {
        int count = groupMapper.save(form);
        return CommonUtils.msg(count);
    }

    @Override
    public List<Group> getGroups(Page<Group> page, Query form) {
        return groupMapper.listForPage(page,form);
    }

    @Override
    public R delGroup(String groupId) {
        int count = groupMapper.remove(groupId);
        return CommonUtils.msg(count);
    }

    @Override
    public R updateGroup(Query form) {
        int count = groupMapper.update(form);
        return CommonUtils.msg(count);
    }

}
